'use strict';
new Component({
  options: {
    addGlobalClass: true,
  },
  externalClasses: ['lee-class'],

  relations: {
    '../col/main': {
      type: 'child',
      linked() {
        this._updateColWidth();
      },
      linkChanged() {
        this._updateColWidth();
      },
      unlinked() {
        this._updateColWidth();
      },
    },
  },

  properties: {
    gutter: {
      type: Number,
      value: 0,
    },
  },

  methods: {
    _updateColWidth() {
      let all = 0
      let list = this.getRelationNodes('../col/main');
      for (const item of list) {
        all += item.data.span;
      }
      for (const item of list) {
        item.setData({ all });
      }
    },
  },
});
